package com.ruitu.mall_98_2.mvp.model;

import com.ruitu.mall_98_2.dao.APIRetrofit;
import com.ruitu.mall_98_2.mvp.contract.BandingAlipayContract;
import com.ruitu.router_module.bean.api.BaseResult;
import com.ruitu.router_module.bean.mine.AlipayInfo;

import okhttp3.MultipartBody;
import rx.Observable;
import rx.Scheduler;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

public class BandingAlipayModel implements BandingAlipayContract.Model {
    @Override
    public Observable<BaseResult<AlipayInfo>> findAlipay(String id) {
        return APIRetrofit.getDefault().findAlipay(id)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }

    @Override
    public Observable<BaseResult> bindAlipay(MultipartBody body) {
        return APIRetrofit.getDefault().bindAlipay(body)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }

    @Override
    public Observable<BaseResult> modifyAlipay(MultipartBody body) {
        return APIRetrofit.getDefault().modifyAlipay(body)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }
}
